<?php

/**
 * Created by PhpStorm.
 * User: man0sions
 * Date: 16/8/31
 * Time: 上午10:34
 */
date_default_timezone_set("PRC");

class SpiderDataFactoryTest extends \PHPUnit_Framework_TestCase
{
    public function getFactory(){

        return new \src\Factory\SpiderDataFactory\SohuSpiderData(new \src\Factory\FormatStrategy\SohuFormatStrategy());
    }

    function testComponentCreation(){
        $json = '{"fee_month":1,"hor_w16_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsa_hor1467860182258_9142437_72Z45_pic29.jpg","latest_video_count_tip":"24\u96c6\u5168","second_cate_name":"\u90fd\u5e02\u5267;\u559c\u5267;\u60c5\u666f\u5267","is_original_code":1,"score":6.8,"album_sub_name":"","aid":9142437,"video_sub_name":"","hor_w8_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsa_hor1467860182258_9142437_085DJ_pic28.jpg","tip":"24\u96c6\u5168","time_length":1194,"first_name":"","ver_high_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsa_ver1467860182944_9142437_51u4W_pic26.jpg","main_actor":"\u5409\u59c6\u00b7\u5e15\u68ee\u65af,\u7ea6\u7ff0\u5c3c\u00b7\u76d6\u5c14\u514b\u5947,\u5361\u857e\u00b7\u5e93\u5965\u79d1,\u897f\u8499\u00b7\u8d6b\u5c14\u4f2f\u683c,\u6606\u7459\u00b7\u5185\u4e9a,\u6885\u4e3d\u838e\u00b7\u52b3\u5947,\u9a6c\u4f0a\u59c6\u00b7\u62dc\u529b\u514b,\u51ef\u6587\u00b7\u82cf\u65af\u66fc","score_tip":"6.8\u5206","area":"\u7f8e\u5267","total_video_count":24,"hor_w6_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsa_hor1467860182258_9142437_55Jwi_pic38.jpg","data_type":257,"year":"2016","program_id":54,"album_name":"\u751f\u6d3b\u5927\u7206\u70b8\u7b2c9\u5b63","vid":3126822,"hor_high_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsa_hor1467860182258_9142437_707K5_pic25.jpg","video_big_pic":"http:\/\/photocdn.sohu.com\/20160708\/vrs_1467910619888_84399712_l4eVH_pic6.jpg","site":1,"hor_big_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsab_hor1467860182258_9142437.jpg","play_count":73965509,"mobileLimit":0,"director":"\u9a6c\u514b\u00b7\u68ee\u5353\u65af\u57fa","cate_code":"101;101107;101111;101113","cid":2,"latest_video_count":24,"ver_big_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsab_ver1467860182944_9142437.jpg","fee":0,"album_desc":"\u5df2\u7ecf\u8ba2\u5a5a\u7684Leonard\u548cPenny\u7ec8\u4e8e\u51b3\u5b9a\u8981\u7ed3\u5a5a\u4e86\u3002\u4ed6\u4eec\u4e0d\u9080\u8bf7\u4efb\u4f55\u4eb2\u670b\u597d\u53cb\uff0c\u98de\u53bb\u62c9\u65af\u7ef4\u52a0\u65af\u5feb\u901f\u4e3e\u884c\u5a5a\u793c\u3002\u5728\u8def\u4e0aLeonard\u5411\u672a\u5a5a\u59bb\u5766\u767d\u4e86\u4e00\u4e2a\u79d8\u5bc6\uff0c\u8fd9\u8ba9\u4ed6\u4eec\u4e4b\u95f4\u4ea7\u751f\u4e86\u88c2\u75d5\u3002\u957f\u8dd1\u591a\u5e74\u3001\u5373\u5c06\u7ed3\u5a5a\u7684Leonard\u548cPenny\u80fd\u5426\u987a\u5229\u5b8c\u5a5a\uff1f\u53e6\u4e00\u65b9\u9762\uff0cSheldon\u906d\u9047\u4e86\u91cd\u5927\u6253\u51fb\u2014\u2014\u5973\u670b\u53cbAmy\u5411\u4ed6\u63d0\u51fa\u5206\u624b\u3002\u4ed6\u591a\u6b21\u8bd5\u56fe\u633d\u56de\uff0c\u7136\u800cAmy\u5bf9\u6b64\u76f8\u5f53\u575a\u51b3\u3002Howard\u548cRaj\u7b49\u8001\u53cb\u4e5f\u4e3a\u4ed6\u4eec\u7684\u4e8b\u800c\u4f24\u795e\u3002","video_name":"\u751f\u6d3b\u5927\u7206\u70b8\u7b2c9\u5b63\u7b2c24\u96c6","publish_time":"2016-07-13","guest":"","ver_w12_pic":"http:\/\/photocdn.sohu.com\/20160707\/vrsa_ver1467860182944_9142437.jpg","is_album":1,"firstcategoryid":2,"creator":"VideoSpider","rs_video":4}';
        $factory = $this->getFactory();
        $ret = $factory->createPlaylistData(json_decode($json));
        $this->assertInstanceOf(stdClass::class,$ret);
    }
}
